/**
 * Collaborative Story Development Web Application (CSDApp) 
 * Copyright Anton Strack 2014
 *
 * This file is part of Collaborative Story Development Application (CSDApp).
 *
 * CSDApp is free software: you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or any later version.
 *
 * CSDApp is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * CSDApp. If not, see <http://www.gnu.org/licenses/>.
 *
 */
package csdwa;

import java.sql.Timestamp;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * A category is a user definable content organizational system that used a a
 * tag like manner but with the additional information of a traditional
 * category.
 *
 * @author Anton Strack
 */
public class Category extends Resource implements CsdwaRecordable, CsdwaNotifiable {

    /**
     * The occurrence of the category among all the resources it is attached to.
     * This provides some tag like functionality to the category view allowing
     * for "category clouds".
     */
    private int frequency;
    /**
     * The name of the category as it will appear to the end user.
     */
    private String name;
    /**
     * A description of the category as it will appear to the end user.
     */
    private String description;
    /**
     * The user id of who created the category.
     */
    private int createdById;
    /**
     * When the category was first created.
     */
    private Timestamp createdDate;

    public Category() {
        super();
    }

    public Category(int resourceTypeId) {
        super(resourceTypeId);
    }

    @Override
    public String toString() {
        return "Category{" + "frequency=" + getFrequency() + ", name=" + getName() + ", description=" + getDescription() + '}' + super.toString();
    }

    /**
     * The occurrence of the category among all the resources it is attached to.
     * This provides some tag like functionality to the category view allowing
     * for "category clouds".
     *
     * @return the frequency
     */
    public int getFrequency() {
        return frequency;
    }

    /**
     * The occurrence of the category among all the resources it is attached to.
     * This provides some tag like functionality to the category view allowing
     * for "category clouds".
     *
     * @param frequency the frequency to set
     */
    public void setFrequency(int frequency) {
        this.frequency = frequency;
    }

    /**
     * The name of the category as it will appear to the end user.
     *
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * The name of the category as it will appear to the end user.
     *
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * A description of the category as it will appear to the end user.
     *
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * A description of the category as it will appear to the end user.
     *
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * The user id of who created the category.
     *
     * @return the createdById
     */
    public int getCreatedById() {
        return createdById;
    }

    /**
     * The user id of who created the category.
     *
     * @param createdById the createdById to set
     */
    public void setCreatedById(int createdById) {
        this.createdById = createdById;
    }

    /**
     * When the category was first created.
     *
     * @return the createdDate
     */
    @Override
    public Timestamp getCreatedDate() {
        return createdDate;
    }

    /**
     * When the category was first created.
     *
     * @param createdDate the createdDate to set
     */
    public void setCreatedDate(Timestamp createdDate) {
        this.createdDate = createdDate;
    }

    @Override
    public int getStateId() {
        Logger.getLogger(Category.class.getName()).log(Level.INFO, "Category getStateId needs to retrieve a finalized state from the infoaggregator");
        return 6;
    }

    @Override
    public Timestamp getUpdatedDate() {
        return createdDate;
    }
}
